/* EasyWay Game Engine
 * Copyright (C) 2006 Daniele Paggi.
 *  
 * Written by: 2006 Daniele Paggi<dshnt@hotmail.com>
 *   
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU Library General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/**
 * 
 */
package org.easyway.editor.forms.southPanel;

import java.awt.Rectangle;

import javax.swing.JButton;
import javax.swing.JPanel;

import org.easyway.editor.analyzer.Analyzer;
import org.easyway.objects.texture.Texture;

/**
 * @author Proprietario
 * 
 */
public class TextureManagerPanel extends JPanel {

	private static final long serialVersionUID = 1L;

	private JButton textureButton = null;

	private JButton textureAlphaButton = null;

	/**
	 * This is the default constructor
	 */
	public TextureManagerPanel() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(930, 82);
		this.setLayout(null);
		this.setName("Texture Manager");
		this.add(getTextureButton(), null);
		this.add(getTextureAlphaButton(), null);
	}

	/**
	 * This method initializes textureButton
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getTextureButton() {
		if (textureButton == null) {
			textureButton = new JButton();
			textureButton.setBounds(new Rectangle(9, 6, 154, 17));
			textureButton.setText("Load Texture");
			textureButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent e) {
						Analyzer.removeFromLPanel();
						try {
							Analyzer
								.addConstructor(
									Texture.class
										.getConstructor(new Class[] { String.class }))
								.command();
						} catch (Exception ex) {
							ex.printStackTrace();
						}

					}
				});
		}
		return textureButton;
	}

	/**
	 * This method initializes textureAlphaButton
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getTextureAlphaButton() {
		if (textureAlphaButton == null) {
			textureAlphaButton = new JButton();
			textureAlphaButton.setBounds(new Rectangle(10, 32, 154, 17));
			textureAlphaButton.setText("Load Alpha Texture");
			textureAlphaButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent e) {
						Analyzer.removeFromLPanel();
						try {
							Analyzer.addConstructor(
								Texture.class.getConstructor(new Class[] {
										String.class, int.class,
										int.class, int.class }))
								.command();
						} catch (Exception ex) {
							ex.printStackTrace();
						}
					}
				});
		}
		return textureAlphaButton;
	}
}
